using Imaginarium.stats;
using Imaginarium.battleSistem;
using Imaginarium.jobs.skills;
using System.Collections.Generic;
using System.Xml;
using Imaginarium.XML;
using Imaginarium.Factorys;


namespace Imaginarium.jobs
{
    public class Job
    {

        public int expConstant { get; set; }
        public int idJob { get; set; }
        public string name { get; set; }
        public Stats incPerLvl { get; set; }
        public List<Skill> skillList { get; set; }
        public List<BattleOption> battleOptions { get; set; }

        public Job()
        {
            battleOptions = new List<BattleOption>();
            skillList = new List<Skill>();
        }
        public Job(XmlElement element)
            :this()
        {
            expConstant = XmlHelper.getIntByTagname(element, XmlParameters.JOB_EXP_CONSTANT);
            idJob = XmlHelper.getIntByTagname(element, XmlParameters.JOB_ID);
            name = XmlHelper.getStringByTagname(element, XmlParameters.JOB_NAME);
            incPerLvl = new Stats(XmlHelper.getXmlElementByTagname(element,XmlParameters.JOB_INC_STATS));
            XmlNodeList skList = XmlHelper.getXmlNodeListByTagname(element, XmlParameters.JOB_SKILL_LIST);
            foreach (XmlElement xe in skList)
            {
                Skill sktoad = SkillFactory.getSkillById(XmlHelper.getIntByTagname(element, XmlParameters.JOB_SKILL_ID));
                if (sktoad != null)
                {
                    skillList.Add(sktoad);
                }
            }
            XmlNodeList bOptions = XmlHelper.getXmlNodeListByTagname(element, XmlParameters.JOB_BATTLE_OPTIONS_LIST);
            foreach (XmlElement xe in bOptions)
            {
                battleOptions.Add(new BattleOption(XmlHelper.getXmlElementByTagname(element, XmlParameters.JOB_BATTLE_OPTION)));
            }
        }
        

    }
}//end Job